package getsmart.project.activity;


import getsmart.project.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.Toast;

import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;

public class ViewListVideo extends ListActivity {
	Intent in;
	public String tempData = "";
	public void onCreate(Bundle icicle) {
		super.onCreate(icicle);
		String[] values = new String[] { "test10.wmv", "test10.wmv", "test10.wmv",
				"test10.wmv", "test10.wmv", "test10.wmv", "Video 1", "Video 1"};
		ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
				android.R.layout.simple_list_item_1, values);
		setListAdapter(adapter);
	}
	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		String item = (String) getListAdapter().getItem(position);
		//Toast.makeText(this, item + " selected", Toast.LENGTH_LONG).show();
		exit(item);
	}
	
	private void exit(String masukan) {
		AlertDialog.Builder builder = new AlertDialog.Builder(this);
		tempData = masukan;
		builder.setMessage("Masukan data" + masukan)
				.setCancelable(false)
				.setPositiveButton("Yes " , new DialogInterface.OnClickListener() {
					public void onClick(DialogInterface dialog, int id) {
//						Intent ind = new Intent(AlertDialogActivity.this, Test.class);
//						startActivity(ind);
						in = new Intent(getApplicationContext(), ViewVideo.class);
						in.putExtra("DataTemp",tempData);
						startActivity(in);
					}
				})
				.setNegativeButton("No ",
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog, int arg1) {
								// TODO Auto-generated method stub
								dialog.cancel();
							}
						}).show();
	}
} 